package com.easy.customer.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easy.common.bean.CustomerInteraction;
import com.easy.common.service.ICustomerInteractionService;
import com.easy.customer.mapper.CustomerInteractionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerInteractionService implements ICustomerInteractionService {
    @Autowired
    CustomerInteractionMapper customerInteractionMapper;

    @Override
    public CustomerInteraction insert(CustomerInteraction customerInteraction) {
        customerInteractionMapper.insert(customerInteraction);
        return customerInteraction;
    }

    @Override
    public CustomerInteraction update(CustomerInteraction customerInteraction) {
        customerInteractionMapper.updateById(customerInteraction);
        return customerInteraction;
    }

    @Override
    public int delete(Integer id) {
        int num = customerInteractionMapper.deleteById(id);
        return num;
    }

    @Override
    public IPage<CustomerInteraction> getListByPage(Page page) {
        IPage<CustomerInteraction> result = customerInteractionMapper.selectPage(page, null);
        return result;
    }
}
